package com.gxw.rxjavatest.Presenter;

import com.gxw.rxjavatest.activity.View.SecView;
import com.gxw.rxjavatest.model.SecModel;
import com.gxw.rxjavatest.model.bean.LogInSec;
import com.gxw.rxjavatest.model.bean.UpLogin;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by GXW on 2016/4/7 0007.
 * email:603004002@qq.com
 */
public class SecPresenter {

    private SecView secView;
    private SecModel secModel;

    public SecPresenter(SecView secView) {
        this.secView = secView;
        this.secModel = new SecModel();
    }

    public void getSecName(UpLogin upLogin) {

        secModel.getNameSec(upLogin).enqueue(new Callback<LogInSec>() {
            @Override
            public void onResponse(Call<LogInSec> call, Response<LogInSec> response) {

                LogInSec body = response.body();
                secView.updateName(body.getData());

            }

            @Override
            public void onFailure(Call<LogInSec> call, Throwable t) {

            }
        });

    }

}
